package com.ericsson.enap.modules.ebmLog.entity.vgc;

import lombok.Data;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @description:多维统计实体类(基类)
 * @author: wangjingshi
 * @create: 2021-11-16 09:16
 */
@Data
public class Dimension {

    public Integer cause_code;
    public Integer sub_cause_code;
    public String k_key;
    public Integer event_result;
    private Integer value;

    private String duration;
    private String tac;
    private String nci;
    private String gnbid;
    private String amfi;
    private String imsi;
    private String msisdn;
    private String imeisv;

    //amf_initial_registration
    public String emergency_registration;//应急注册标识维度
    public String slice_selection_result;//切片选择结果

    //amf_service_request
    public Integer service_request_type;//服务请求类型维度
    public String _service_request_type;
    public Integer service_request_trigger;//服务请求触发维度
    public String _service_request_trigger;
    public String request_retries;//服务请求重试次数
    public Integer dnn;
    public String _dnn;
    public String pdu_session_reactivation_result;//PDU会话重激活结果维度

    //amf_paging
    public String paging_attempts;//寻呼尝试次数维度
    public String paging_trigger;//寻呼触发维度
    public String total_no_of_paged_ngran_node;//寻呼范围维度

    //amf_pdu_session_establishment
    public Integer ue_requested_dnn;
    public String _ue_requested_dnn;
    public String smf_ipv6;//SMF IPV6维度
    public String s_nssai;//S-NSSAI维度

    //amf_handover
    public Integer n_handover_type;//过滤条件的handover_type
    public String handover_type;
    public String handover_rat_change_type;
    public String eps_fallback_triggered;
    public String old_gnbid_new_gnbid;
    public String old_tac_new_tac;
    public String old_amfi_new_amfi;
    public String old_tac_new_eps_tac;
    public String old_amfi_new_mme;

    //amf_deregistration
    public Integer deregistration_trigger;//去注册触发维度
    public String _deregistration_trigger;
    public String reregistration_required;//重注册标识维度

    private String dateTime;
    private String dT15;//15分钟粒度
    private int total;
    private int abort;
    private int reject;
    private int ignore;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dimension t = (Dimension) o;
        return cause_code.equals(t.cause_code) && sub_cause_code.equals(t.sub_cause_code) && k_key.equals(t.k_key);
    }

    @Override
    public int hashCode() {
        return Objects.hash(cause_code, sub_cause_code, k_key);
    }

    /*public String getDimensionByName(String k_name){
        switch(k_name){
            case "duration":return getDuration();
            case "tac":return getTac();
            case "nci":return getNci();
            case "gnbid":return getGnbid();
            case "amfi":return getAmfi();
            case "imsi":return getImsi();
            case "msisdn":return getMsisdn();
            case "imeisv":return getImeisv();
            case "emergency_registration":return getEmergency_registration();
            case "slice_selection_result":return getSlice_selection_result();
            default:
                return null;
        }
    }*/

    public void setFailNumber(Integer event_result){
        switch(event_result){
            case 2 : setAbort(getAbort()+1);break;
            case 3 : setIgnore(getIgnore()+1);break;
            case 4 : setReject(getReject()+1);break;
        }
    }

}
